home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / graphics / tooltipf / tooltips.txt < prev   
Text File  |  1995-12-30  |  2KB  |  68 lines

  1. Legal Stuff
  2. -----------
  3.  
  4.     This archive is supplied 'AS IS' without any warranty of any kind. I
  5. (Jonathan Friend) cannot be held responsable for any or all damage caused 
  6. directly or indirectly by any or all of the contents of this archive.
  7. -----------------------------------------------------------------------------
  8.  
  9. Now the legal stuff is over . . .
  10.  
  11. So, you want to enhance your VB applications with 'ToolTips'. Well, here is
  12. a simple way to do it.
  13.  
  14. Instructions
  15. ------------
  16.  
  17. 1.    Add 'TOOLTIPS.BAS' and 'FRMHELP.FRM' to your project (CTRL-D).
  18.  
  19. 2.    On the form where the controls are you want 'ToolTips' for, add
  20.     a timer with its 'Interval' property set to '1000' and its 'Enabled'
  21.     property set to 'True'.
  22.  
  23. 3.    Place the following code in the timer event of Timer1.
  24.  
  25.  
  26. Sub Timer1_Timer ()
  27. Dim curhWnd As Integer
  28. Dim p As POINTAPI
  29. Static LasthWnd As Integer
  30.  
  31. If GetActiveWindow() = frmMain.hWnd Then
  32.     Call GetCursorPos(p)
  33.     curhWnd = WindowFromPoint(p.y, p.x)
  34.  
  35.     If curhWnd <> LasthWnd Then
  36.         LasthWnd = curhWnd
  37.         Timer1.Interval = 5
  38.         Select Case curhWnd
  39.             Case btnKill.hWnd
  40.                 DisplayHelp "Delete File/Directory" 
  41.             'The above is just an example of the things you should put in
  42.         Case frmHelp.hWnd
  43.                 frmHelp.Hide
  44.             Case Else
  45.                 DisplayHelp ""
  46.                 Timer1.Interval = 1000
  47.             'The above two cases are necessary! You MUST put them in!
  48.     End Select
  49.     End If
  50. End If
  51. End Sub
  52.  
  53.  
  54. 4.    Now, run your program. When you hold the mouse over one of the
  55.     selected controls, a small box will appear with you description in.
  56.  
  57.  
  58.   YOU CAN ALSO HAVE A LOOK AT THE EXAMPLE PROJECT IN THE EXAMPLE DIRECTORY
  59.  
  60. Happy Programming
  61.  
  62. Jonathan Friend
  63.  
  64. You can contact me by Email:
  65.  
  66. Internet   : 101331.3160@compuserve.com
  67. Compuserve : 101331,3160
  68.